package org.cpar.compiler.nodes;

import org.antlr.runtime.Token;
import org.antlr.runtime.tree.Tree;
import org.cpar.compiler.CPARNode;
import org.cpar.compiler.ICodeWriter;

public class AnsiFunction extends CPARNode {

	public AnsiFunction(AnsiFunction f) {
		super(f);
	}

	public AnsiFunction(Token nextToken) {
		super(nextToken);
	}

	@Override
	public Tree dupNode() {
		return new AnsiFunction(this);
	}

	@Override
	public void accept(ICodeWriter writer) {
		writer.visit(this);
	}

	public String getName() {
		return getToken().getText();
	}

	public CPARNode getParameters() {
		return (CPARNode) getChild(0);
	}

	public CPARNode getBody() {
		return (CPARNode) getChild(1);
	}

	public CPARNode getReturnType() {
		return (CPARNode) getChild(2);
	}
}
